Form1 #VBENGINE SAMPLE APPLICATION - DEMO2 Form1, Label1 Customer: Text1 Label5 Address: Text2 Label6 City: Text3 Label7 State: Text4 Label8 Text5 Label9 Phone: Text6 TopButton BottomButton Bottom PreviousButton Previous NextButton UpdateButton Update InsertButton Insert DeleteButton Delete QuitButton ClearButton Clear Command1_Click result OpenEngine CloseEngine OpenTable Data1 DBase TableJ TableNamed IndexID SaveChgs CloseTable9 GetRecord Field, FieldName SetField GetFieldTypeE FieldType GetField FieldValue Text1v Text2 Text3 Text4 NextRecord PreviousRecord PutField LastRecord UpdateRecordK SearchField Record SearchMode FIRSTRECORDh KeySearchH SearchKey' RecordLock; RecordUnlockLock RecordUnlock RefreshTable TableLock LockTable FULLLOCK UnlockTable FALSE FlushBuffers] MyName GetUserName Form_Click Form_Load? Form_UnloadZ Cancel GetIT. FillForm Command4_Click/ Command3_ClickA Command9_ClickS Command2_Clicke Command5_Clickw Command6_Click Command7_Click InsertRecord Command8_Click DeleteRecordj Text5 Text6 Text7 Text8 UpdateM Text9 Text10 Insert Text4_Change SHARE MASTERINDEX Form_DblClick EmptyTable MNU_Click EncryptTable DecryptTable Password Data2\ CreateTable Label4_Click NFlds FldTypes FldNames: Testy NewTable NFields FieldNames FieldTypesm AddKey PRIMARY DeleteKey2 GotoRecord RecordNumber GetRecordNumber IsFieldBlank BlankPtr PutBlank DataTablev Customer SaveEveryChange TopButton_Click BottomButton_Click PreviousButton_Click NextButton_Click DeleteButton_Click UpdateButton_Click InsertButton_Click QuitButton_Clickl Text1_Change status ClearButton_Click Text1_LostFocus KeSearch SEARCHFIRST NewNamer Create a database variable using the DataTable structure for database operations Form_Load Initialize VBENGINE so that database capabilities are enabled. Call OpenEngine() with a string representing the user's name.. and using SHARE representing file sharing mode.. Visual Basic Now put the data table file name (C:\CUSTOMER.DB) in the data structureA C:\CUSTOMER" We will use the tables master index: We will buffer data changese Now open the table Now read in the data from the first record and place it in our form. Form_Unload FillForm Get the record from the table Now lets get the customers name and put it in our form.f Specify what field we are interested in. Read in the value. Place it in the form. Now do the same thing for every field in our form .... Address" State" Phone" Update Here we do the same process found in the Insert subroutine.. See that routine for reference.. Address" State" Phone" Here we UPDATE the current record in the table.. Insert Here we are transfering information from our form to the table.. We must first associate a form value with specific fields in our table.. We will make such associations by first specifying the data table field of interest. Then take the data from the corresponding form field and thenn put the field into the current record. Specify the field in the data table. Place corresponding form data into the database structures FieldValue member. Now put the field structure into the current record. Now repeat the process for all form fields.. Address" State" Phone" Now INSERT the current record into the table.. MNU_Click TopButton_Click Move to the first record in the table. Now fill in the form BottomButton_Click Move to the last record in the table.. Now fill in the form PreviousButton_Click Move to the previous record in the table.L Now fill in the form.r NextButton_Click Move to the next record in the table.b Now fill in the form.r DeleteButton_Click Delete the current record from the data table. Now fill in the form.c UpdateButton_Click InsertButton_Click QuitButton_Click Close the data table.c Shut down the VBENGINE environment.d Now quit this application. ClearButton_Click Text1_LostFocus For error handling Temp variable for new customer namew Primary key field is Namew We will search for user supplied customer name We will search from 1st record to 1st matche Search on the 1st field of primary index This table only has 1 key field anyway.p Place search criteria into the database engine Start to search on the Primary index If search failed Put new customer name in temporary variablen Clear the form u Place new name back on the forma Return to user input If search was successfullf Place the customer's info on the formo